package restlike.demo.shoreditchairways

import im.mange.shoreditch.api.liftweb.ServiceHelper
import ServiceHelper._
import im.mange.shoreditch.api._
import im.mange.shoreditch.api.liftweb.ServiceHelper

//TODO: rename confirmed to received
object Finance extends ServiceHelper(base = "finance", version = "10001")(
  "payment/confirmed/@pnr" check PaymentConfirmed
)

case class PaymentConfirmed(pnr: String) extends Check {
  override def run =
    if (DemoState.bookings.exists(b => b.ref == pnr && b.paymentConfirmed)) success
    else failure(List("No payment found for pnr: " + pnr))
}
